document.addEventListener('DOMContentLoaded', function() {
  var fpsElement = document.createElement('div');
  fpsElement.id = 'fps';
  fpsElement.style.position = 'fixed';
  fpsElement.style.top = '3px';
  fpsElement.style.left = '3px';
  fpsElement.style.zIndex = '10000';
  fpsElement.style.color = 'black'; // 字体颜色设置为黑色
  fpsElement.style.backgroundColor = 'transparent'; // 背景设置为透明
  fpsElement.style.padding = '5px';
  fpsElement.style.borderRadius = '3px';
  fpsElement.style.fontFamily = 'Arial, sans-serif';
  fpsElement.style.fontWeight = 'bold';
  document.body.appendChild(fpsElement);

  var fps = 0;
  var last = Date.now();
  function step() {
    var now = Date.now();
    fps++;
    if (now - last >= 1000) {
      fpsElement.textContent = fps + ' FPS';
      fps = 0;
      last = now;
    }
    requestAnimationFrame(step);
  }
  requestAnimationFrame(step);
});